package com.crois.barrier.admin.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.crois.barrier.admin.entity.ApiRouteGroup;
import com.crois.barrier.admin.mapper.ApiRouteGroupMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * barrier api组表
 * @author Hou Ze Yu
 * @date 2021-10-25 11:58:24
 */
@Slf4j
@Service
@Transactional(rollbackFor = Exception.class)
public class ApiRouteGroupSvc extends ServiceImpl<ApiRouteGroupMapper,ApiRouteGroup> implements IApiRouteGroupSvc {

    @Override
    public List<ApiRouteGroup> findApiRouteGroupList(String apiGroupName) {
        QueryWrapper<ApiRouteGroup> apiRouteGroupQueryWrapper = new QueryWrapper<>();
        if (StringUtils.isNotEmpty(apiGroupName)){
            apiRouteGroupQueryWrapper.lambda().like(ApiRouteGroup::getApiRouteGroupName,"%"+apiGroupName+"%");
        }
        return baseMapper.selectList(apiRouteGroupQueryWrapper);
    }
}
